package com.duohe.demo;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

public class MyCustomConsrtranintValidator implements ConstraintValidator<MyCustomConstranint, String> {
   public void initialize(MyCustomConstranint constraint) {
   }

   public boolean isValid(String obj, ConstraintValidatorContext context) {
      if (!(obj.equals("北京")||obj.equals("上海"))){
         return false;
      }
      return true;
   }
}
